import instance from '@/util/http'
import { dispatchEditInfo, type dispatchS } from '@/page/types/dispatch/dispatch'
import { dispatchLogsSA } from '@/page/types/dispatch/dispatchLogs'
import { NULL } from 'sass'
/**
 * 搜索调度分页
 * @param data
 */
export const dispatchPage = async (data: dispatchS) => instance.post('/dispatch/dis/page', data)
/**
 * 保存调度
 * @param data
 */
export const dispatchSave = async (data: dispatchEditInfo) => instance.post('/dispatch/dis/add', data)
/**
 * 更新调度
 * @param data
 */
export const dispatchUpdate = async (data: dispatchEditInfo) => instance.put('/dispatch/dis/update', data)
/**
 * 调度详情
 * @param data
 */
export const dispatchDetail = async (id: string) => instance.get('/dispatch/dis/detail/' + id)
/**
 * 开启和暂停定时任务
 * @param data
 */
export const dispatchPauseOrRes = async (id: string, isPause: boolean) => instance.put('/dispatch/dis/pauseOrRes/' + id, isPause)

/**
 * 开启和暂停定时任务
 * @param data
 */
export const deleteDispatch = async (id: any) => instance.delete('/dispatch/dis/delete/' + id)
/**
 * 查看调度日志分页
 * @param data
 */
export const dispatchLogsPage = async (data: dispatchLogsSA) => instance.post('/dispatch/dis/logs/page', data)
/**
 * 调度日志详细日志
 * @param data
 */
export const dispatchLogsDetail = async (id: string) => instance.get('/dispatch/dis/logs/detail/' + id)
/**
 * 调度日志删除
 * @param data
 */
export const dispatchLogsDelete = async (endTime: string) => instance.delete('/dispatch/dis/logs/delete', null, { endTime: endTime })
/**
 * 获取枚举list
 */
export const getEnumList = (name: string) => instance.get('/dispatch/enum/getList/' + name)
